package org.exes;

import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.logging.Level;
import java.util.logging.Logger;

public class AccesoAleatorio {
     public static void main(String[] args) {
        RandomAccessFile raf = null;
        try{
            raf = new RandomAccessFile("c:\\pruebas.txt", "rw");
            raf.seek(100);
            raf.writeBytes("Texto!!!");
            raf.seek(100);
            raf.writeByte('W');
            raf.seek(2);
            byte leido = raf.readByte();
            System.out.println((char)leido);
            
        }catch(IOException ex){
          Logger.getLogger(AccesoAleatorio.class.getName()).log(Level.SEVERE, null, ex);
        }finally{
            if(raf!=null){
                try {
                    raf.close();
                } catch (IOException ex) {
                    Logger.getLogger(AccesoAleatorio.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }

    }

}
